package cn.sytton.taffecloud.common.servlet.request;

import cn.sytton.taffecloud.common.servlet.log.LogWriter;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Request拦截器
 *
 * @author skyrock
 */
@Component
public class RequestInterceptor implements HandlerInterceptor {

    @Resource
    private LogWriter logWriter;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        logWriter.logBegin(request, handler);
        return true;
    }

}
